package org.jjj;

import org.jjj.user.interceptor.LoginInterceptor;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

/**
 * 启动类
 */
@SpringBootApplication
@MapperScan("org.jjj.*.mapper")
public class CarAppStart implements WebMvcConfigurer {
    @Autowired
    private LoginInterceptor loginInterceptor;
    public static void main(String[] args) {
        SpringApplication.run(CarAppStart.class,args);
    }

    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        registry.addInterceptor(loginInterceptor)
                //拦截地址
                .addPathPatterns("/**")
                //放行地址
                .excludePathPatterns("/logininfo/login/**")
                .excludePathPatterns("/logininfo/wechat/**")
                .excludePathPatterns("/logininfo/phoneSmsCode/**")
                .excludePathPatterns("/user/register/**")
                .excludePathPatterns("/user/retrievepassword/**")
                .excludePathPatterns("/user/bind/**")
                .excludePathPatterns("/verifyCode/**")
                .excludePathPatterns("/fastdfs");
    }
}
